#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableGemDao:DaoBase<TableGem>
    {
        public override string GetFileName()
        {
            return "TableGem.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableGem>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableGem model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.gemId)) UnityEngine.Debug.LogError("数据表id重复:TableGem->id: " + model.gemId);
            #endif
            cachePrimaryInt[model.gemId] = model;
        }
        protected override TableGem ParseRowData(string[] rowData)
        {
            TableGem data = new TableGem();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.gemId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.level = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.color = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.addProp = rowData[3];
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.gemCost = rowData[4];
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.otherCost = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.asSource = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.type = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.buffDesc = string.Intern(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.extraFightPower = int.Parse(rowData[9]);
            }
            return data;
        }
    }
}
